<template>
	<view class="content">
		<view class="stats-list">
			<view class="stats-item" v-for="(value, key, index) in list" :key="index">
				<view class="stats-title">
					<text>{{key}}月收入</text>
				</view>
				<view class="stats-value">
					<text>￥{{value}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				myInfo: {},
				list: null,
				page: 1,
				status: 'more',
				contentText: {
					contentdown: '加载更多',
					contentrefresh: '加载中',
					contentnomore: '木有了~'
				},
			}
		},
		onLoad(options) {
			try {
				const myInfo = uni.getStorageSync('myInfo');
				if (myInfo) {
					this.myInfo = myInfo
				}
			} catch (e) {
				console.log(e)
			}
		},
		onReady() {
			this.getUserWallet();
		},
		onPullDownRefresh() {
			this.page = 1;
			setTimeout(() => {
				this.getUserWallet();
			}, 500)
		},
		methods: {
			getUserWallet: function () {
				this.$api.api.ajaxData({
					method: 'V1.UserWallet',
					uid: this.myInfo.id,
					token: this.myInfo.token
				}, res => {
					uni.stopPullDownRefresh();
					if (res.status) {
						this.wallet = res.data.wallet
						this.wait = res.data.wait
						this.month = res.data.month
						this.rose = res.data.rose
						this.list = res.data.month
					}
				})
			},
			
		}
	}
</script>

<style lang="scss">
	@import '../../common/common.scss';
	.stats-item {
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
		padding: 20rpx;
		margin-bottom: 1rpx;
		background-color: #FFFFFF;
		.stats-title {
			text {
				font-size: 28rpx;
				color: $title-color;
			}
		}
		.stats-value {
			text {
				font-size: 28rpx;
				color: $main-color;
			}
		}
	}
</style>
